package com.alfred.springboot.elasticjob.lite.demo.job;

import com.alfred.springboot.elasticjob.lite.core.annotation.ElasticJob;
import com.alfred.springboot.elasticjob.lite.utils.JsonUtils;
import com.dangdang.ddframe.job.api.JobType;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@ElasticJob(jobName = "ElasticJobAnnotationJobDemoScheduler",
        jobType = JobType.SIMPLE,
        corn = "0/20 * * * * ?",
        shardingTotalCount = 1,
        shardingItemParameters = "0=all")
@Component
public class TestSimpleJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("\n-    开始执行作业：{},\n-    作业详情信息：\n-  {}",this.getClass().getCanonicalName(), JsonUtils.object2String(shardingContext));


        log.info("\n-   完成作业{}执行。", this.getClass().getCanonicalName());
    }
}
